package addon.w3.mdx.com;

import java.io.IOException;
import java.util.Vector;

import addon.w3.mdx.LEDataInputStream;
import addon.w3.mdx.MDXException;
import addon.w3.mdx.MDXParentCOM;

/**
RIBB
	long	nbytes;
	struct {
		long	nbytesi;
		long	nbytesikg;		// inclusive bytecount including KGXXs
		ASCII	Name;			(0x50 bytes)
		long	ObjectID;
		long	Parent; 		(0xFFFFFFFF if none)
		long	Flags;			(0x00400000)
		(KGTR)
		(KGRT)
		(KGSC)
		float	HeightAbove;
		float	HeightBelow;
		float	Alpha;
		float	ColorR, ColorG, ColorB;
		float	LifeSpan;
		long	???;			(0)
		long	EmissionRate;
		long	Rows;
		long	Columns;
		long	MaterialID;
		float	Gravity;
		(KRVS)
		(KRHA)
		(KRHB)
	} ribbs[nribbs];
 * @author madjk
 * not tested;
 */
public class MDXRibbonEmitters extends MDXParentCOM {
	int length = -1;
	Vector remitters = null;
	
	public String getTag() {
		return "RIBB";
	}
	
	public void _decode(LEDataInputStream ins) throws IOException, MDXException {
		length = ins.readInt();
		int cntLength = 0;
		remitters = new Vector();
		while(cntLength < length) {
			MDXRibbonEmitterCOM mdcom = new MDXRibbonEmitterCOM();
			mdcom.decode(ins);
			remitters.add(mdcom);
			cntLength += mdcom.nbytesi;
			System.out.println(" cntLength : "+cntLength +"/"+ length);
			debug( mdcom.toString() );
		}
		//debug( geosets.get( (geosets.size()-1) ).toString() );
	}
	
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("TAG : "+getTag());
		sb.append("\n\tELEN : "+length);
		if(remitters != null && remitters.size() > 0) sb.append("\n\tREMITTERS[] : "+remitters.size());
		return sb.toString();
	}

	@Override
	public boolean isImplicitTag() {
		// TODO Auto-generated method stub
		return true;
	}
}